home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / bindings / fun / exit < prev    next >
Encoding:
Text File  |  1996-09-27  |  1.4 KB  |  59 lines

  1. ;OCL{{{}}}
  2. ;OCL{{{  comments
  3. ; simulate exit-origami and save-and-exit-origami
  4. ;OCL}}}
  5. @if-using not(ocl-file-exit)
  6.   @use (ocl-file-exit)
  7.   ;OCL{{{  variable
  8.   ( defvar ( exit-save ) )
  9.   ;OCL}}}
  10.   ;OCL{{{  exit-origami
  11.   ( deffun exit-origami
  12.      ( do
  13.         ;OCL{{{  exit one buffer
  14.         ( exit-buffer
  15.           if in-prompt
  16.            (
  17.              ;OCL{{{  if last file, end macro, user can answer himself
  18.              if =(used-buffers 1) ( return-from-macro ) fi
  19.              ;OCL}}}
  20.              ;OCL{{{  ask for answer
  21.              begin-prompt-macro
  22.              prompt-counter exit-save ( M_CHANGED_LEAVE "  "? "   )
  23.              end-prompt-macro
  24.              ;OCL}}}
  25.              ;OCL{{{  put answer in stream
  26.              screen-off
  27.              if exit-save ( "Y ) else ( "N ) fi
  28.              screen-on
  29.              newline-and-indent
  30.              ;OCL}}}
  31.              ;OCL{{{  N -> ready!
  32.              if =(exit-save 0) ( return-from-macro ) fi
  33.              ;OCL}}}
  34.            )
  35.           fi
  36.         )
  37.         ;OCL}}}
  38.        while 1
  39.      )
  40.   )
  41.   ;OCL}}}
  42.   ;OCL{{{  save-and-exit-origami
  43.   ( deffun save-and-exit-origami
  44.      ( do
  45.         ( set exit-save current-buffer-id
  46.           save-and-exit-buffer
  47.           if =(exit-save current-buffer-id)
  48.            ( return-from-macro )
  49.           fi
  50.         )
  51.        while 1
  52.      )
  53.   )
  54.   ;OCL}}}
  55.   ;OCL{{{  undeclares
  56.   ( undeclare ( exit-save ) )
  57.   ;OCL}}}
  58. @fi
  59.